﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace RBAC_Uthorization.Infrstructre
{
    public interface IBaseRepository<T> where T : class, new()
    {
        /// <summary>
        /// 增
        /// </summary>
        /// <param name="Entity"></param>
        /// <returns></returns>
        Task<int> AddAsync(T Entity);
        /// <summary>
        /// 删
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        Task<int> DeleteAsync(int Id);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="Entity"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(T Entity);
        /// <summary>
        /// 查
        /// </summary>
        /// <returns></returns>
        Task<List<T>> GetAllAsync();
        /// <summary>
        /// 根据id查询
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        Task<T> GetbyIdAsync(object Id);
        /// <summary>
        /// 条件查询
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        Task<List<T>> GetAllAsunc(Expression<Func<T, bool>> expression);
        /// <summary>
        /// 开启事务
        /// </summary>
        /// <returns></returns>
        Task BeginTransactionAsync();
        /// <summary>
        /// 提交事务
        /// </summary>
        /// <returns></returns>
        Task CommitTransactionAsync();
        /// <summary>
        /// 回滚事务
        /// </summary>
        /// <returns></returns>
        Task RollbackTransactionAsync();





    }
}
